home *** CD-ROM | disk | FTP | other *** search
- #include <MemoryTools.h>
-
- /*------------------------------------------------------------------------------*/
-
- Ptr Ptr2Ptr (Ptr InData)
- /* make a copy of the passed pointer */
- {
- Ptr NewPtr = NULL;
-
- if (InData)
- {
- NewPtr = NewPtrClear(GetPtrSize(InData));
- if (NewPtr)
- {
- BlockMove(InData, NewPtr, GetPtrSize(InData));
- return NewPtr;
- }
- else
- return NULL;
- }
- else
- return NULL;
- }
-
- /*------------------------------------------------------------------------------*/
-
- Handle Ptr2Hand (Ptr Data)
- /* create a handle containing the same data as the passed-in pointer */
- {
- Handle TempHandle = NewHandle (GetPtrSize(Data));
-
- if (TempHandle)
- BlockMove (Data, *TempHandle, GetPtrSize(Data));
- return TempHandle;
- }
-
- /*------------------------------------------------------------------------------*/
-
- Ptr Hand2Ptr (Handle Data)
- /* create a ptr containing the same data as the passed-in handle */
- {
- Ptr TempPtr = NewPtr (GetHandleSize(Data));
-
- if (TempPtr)
- BlockMove (*Data, TempPtr, GetHandleSize(Data));
- return TempPtr;
- }
-
- /*------------------------------------------------------------------------------*/
-
- void DoNukePtr (Ptr *PtrAddr)
- {
- if (*PtrAddr)
- DisposPtr(*PtrAddr);
- *PtrAddr = NULL;
- }
-
- /*------------------------------------------------------------------------------*/
-
- void DoNukeHandle (Handle *HandleAddr)
- {
- if (*HandleAddr)
- DisposHandle(*HandleAddr);
- *HandleAddr = NULL;
- }
-
-